package com.my.hbase;

import org.apache.log4j.Logger;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 *  获取配置实例<br/>
 *  单实例模式<br/>
 *  @author  liujiankang
 *  @version  2016-07-15
 */
public class Config {

    private static Logger logger = Logger.getLogger(Config.class.getName());

    private static Properties prop = new Properties();

    private Config(){}

    static {
        InputStream in = Config.class.getClassLoader()
                .getResourceAsStream("config.properties");
        try {
            prop.load(in);
        } catch (IOException e) {
            logger.error(e);
            logger.error("无法正确读取到环境配置文件,JVM将退出.");
            System.exit(1);
        }
    }

    public static String getPropertie(String key) {
        return prop.getProperty(key).trim();
    }
}
